<!--
*@Author: QWP
*@Description: 考勤登记编辑
*@Date: 2024-07-08 17:04:38
-->
<template>
  <u-dialog v-bind="$attrs"
    @close="dialogClose">
    <a-layout class="f-h-100">
      <a-layout-content class="s-bg-white"
        style="overflow: auto">
        <a-space  direction="vertical">
          <u-busi-card title="基本信息"
            :bordered="false">
            <u-form :elements="formEls"
              :model="form"
              :gutter="0"
              ref="formRef">
            </u-form>
          </u-busi-card>
          <u-busi-card title="文件上传"
            :bordered="false">
            <u-edit-table :columns="columns"
              :data="tabData"
              :addBtn="false"
              :uploadBtn="true"
              :scroll="{ y: 300 }">
            </u-edit-table>
          </u-busi-card>
        </a-space>
      </a-layout-content>
    </a-layout>
  </u-dialog>
</template>

<script lang='ts' setup>
import { ref, reactive, computed, onMounted, h } from 'vue' 

import { useRoute, useRouter } from 'vue-router'
import { _IFormEl, _IExtra } from '@/src/components/common/form/interface';
import { FormInstance, FormItemProps } from 'ant-design-vue';
import { HomeOutlined, FileTextOutlined, UploadOutlined } from '@ant-design/icons-vue';
import { TreeProps } from 'ant-design-vue/es/vc-tree';
import { ColumnProps } from 'ant-design-vue/es/table';
import { _IColumnProps } from '@/components/common/tableEdit/interface.ts'
import { fileCols } from '@/common/model/fileCols'
import { depts, users } from '@/common/model/base'
import dayjs from 'dayjs';
const route = useRoute()

const formRef = ref<FormInstance>()
const form = reactive({
  lrsj: dayjs().format('YYYY-MM-DD')
})
const formItemProps: FormItemProps & _IExtra = {
  labelWidth: '90px',
  colon: false
}
const formEls: Array<_IFormEl> = [
  { label: '所属部门', key: 'ssbm', col: { span: 8,}, element: 'select', 
    formItemProps: { ...formItemProps, required: true },
    componentProps: { options: depts }
  },
  { label: '人员', key: 'ry', col: { span: 8 }, element: 'select', 
    formItemProps: { ...formItemProps, required: true },
    componentProps: { options: users }
  },
  { label: '考勤类型', key: 'kqlx', col: { span: 8 }, element: 'select', 
    formItemProps: { ...formItemProps, required: true },
    componentProps: { 
      options: [
        { label: '加班', value: '1'},
        { label: '病假', value: '2'},
        { label: '年假', value: '3'},
        { label: '事假', value: '4'},
      ]
    }
  },
  { label: '开始日期', key: 'ksrq', col: { span: 8 }, element: 'datepicker', 
    formItemProps: { ...formItemProps, required: true } 
  },
  { label: '结束日期', key: 'ksrq1', col: { span: 8 }, element: 'datepicker', 
    formItemProps: { ...formItemProps, required: true } 
  },
  { label: '录入时间', key: 'lrsj', col: { span: 8 }, element: 'datepicker', 
    formItemProps: { ...formItemProps, } ,
    componentProps: { disabled: true, defaultValue: new Date() }
  },
  { label: '天数', key: 'ts', col: { span: 8 }, element: 'number', 
    formItemProps: { ...formItemProps, } ,
    componentProps: { disabled: true }
  },
  { label: '事由', key: 'sy', col: { span: 24 }, element: 'textarea', 
    formItemProps: { ...formItemProps } 
  },
]

// 文件上传列表
const tabData: Array<any> = reactive([]); 
const columns: Array<_IColumnProps> = fileCols(); 

// 文件上传列表
const detialTabData: Array<any> = reactive([]); 
const detialCols: Array<_IColumnProps> = [
  { title: '资产名称', dataIndex: 'zcmc', minWidth: 150, element: 'input' },
  { title: '借用人', dataIndex: 'jyr', minWidth: 150, element: 'select' },
  { title: '数量', dataIndex: 'sl', minWidth: 150, element: 'number' },
  { title: '借用期限', dataIndex: 'jysm', minWidth: 150, element: 'number' },
]; 


// 弹窗关闭
const dialogClose = () => {
  formRef.value.form.resetFields();
}
</script>

<style lang='scss' >
</style>